package com.lc1993929.kafka.producer;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Created by LiuChang on 2017/7/21/021.
 */
@Service
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:spring.xml")
public class KafkaProducerServer {
    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    @Test
    public void testTemplateSend() {
        kafkaTemplate.send("mykafka", "大天才");
    }

}
